<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <body>

        <ui:composition template="./../adminTemplate.xhtml">

            <ui:define name="title">
                title
            </ui:define>

            <ui:define name="page">
             <div class="container">
                  
               

                <h:form class="form"> 

                   <p:selectOneMenu value="#{create.listDinnerNames.finemenuId}" style="margin-bottom: 10px"> <!-- select one menu lets user  select a menu to edit-->

                        <f:selectItem  itemLabel="Välj Meny"></f:selectItem>
                        <f:selectItems value="#{create.menuList}" var="f"  itemValue="#{f.fineMenuId}" itemLabel="#{f.fineMenuName}"/> 

                   </p:selectOneMenu><br/>
                    
                    <p:commandButton value="välj" style="margin-left: 5px;"  action="#{create.prepareCreate()}"></p:commandButton> 
                    
                                
                </h:form>
               
                
                <h:form class="form">
                   
                    
                   <h:selectManyListbox value="#{create.listDinnerNames.selectedValues}" label=" välj rätter" > <!-- already selected values -->
                         
                        <f:selectItems value="#{create.dinnerNameList}" var="f"  itemValue="#{f}" itemLabel="#{f}"/> <!--select items  a list of available courses-->
                        
                    </h:selectManyListbox> <br/><br/>
                    
                    <p:commandButton value="spara meny" action="#{create.listDinnerNames.add()}"></p:commandButton> <!--adds dinner names to menu-->
                    
                    
                    <p:commandButton value="ta bort meny " action="#{create.destroy(create.listDinnerNames.finemenuId)}"></p:commandButton> <!-- destroys a selected menu-->
              
                    
                   
                    </h:form>
                 
                  <h:form class="frm">
                    <p:outputLabel value ="Lägg till en ny meny:" style="margin-right: 5px;"></p:outputLabel> 
                    <p:inputText style="margin-right: 5px;" value="#{create.menuName}"/> 
                    <p:commandButton value="spara" action="#{create.createName()}"></p:commandButton> <!-- calls function that insert a menuname in database -->
                </h:form>
                
                </div>
            </ui:define>

        </ui:composition>

    </body>
</html>
